package interview;
//剑指 Offer 10- I. 斐波那契数列
import com.sun.org.apache.regexp.internal.RE;

public class Num10_I_fib {
    public int fib(int n) {
        final int MOD=1000000007;
        if (n<2){
            return 1;
        }
        int p=0;int q=0;int r =1;
        for (int i = 2; i <= n; i++) {
            p=q;
            q=r;
            r=(p+q)%MOD;
        }
        return r;
    }
}
